package org.pettyfox.utils.io.bis.bean;

import org.pettyfox.utils.io.bis.IniFileWriteRead;
import org.pettyfox.utils.io.bis.annotation.IniField;

import java.io.IOException;
import java.io.Serializable;

/**
 *     
 *
 * @author pettyfox.top  
 * @version V1.0   
 * @date 2020-05-10
 */
public abstract class BaseBeanIni implements Serializable {
    private  IniFileWriteRead iniFileWriteRead;
    @IniField(comments = {"配置文件版本，不要随意改动"})
    private int version;
    /**
     * 版本号在修改后递增，版本号比配置文件的高会将bean写到配置文件中。但会以配置文件的配置的高优先级
     * @return 配置文件版本号
     */
    public abstract int getVersion();
    public void setVersion(int version){
        this.version = version;
    }
    protected void init()  {
        try {
            iniFileWriteRead =  new IniFileWriteRead(this);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
